import 'package:coinbaby/login&regist/forget_pwd.dart';
import 'package:coinbaby/login&regist/login.dart';
import 'package:coinbaby/login&regist/pwd_login.dart';
import 'package:coinbaby/login&regist/pwd_setting.dart';
import 'package:coinbaby/login&regist/reset_pwd.dart';
import 'package:coinbaby/main.dart';
import 'package:coinbaby/page/autobuy/page/create_strategy.dart';
import 'package:coinbaby/page/autobuy/page/strategy.dart';
import 'package:coinbaby/root/root.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'login&regist/sms_code.dart';

final routes = {
  // home
  '/': (context) => MainPage(),
  // tabbar
  '/root': (context) => RootPage(),
  '/login': (context) => LoginPage(),
  '/smscode': (context) => SmsCodePage(), // 验证码登陆
  '/pwdlogin': (context) => PwdLoginPage(), // 密码登陆
  '/pwdsetting': (context) => PwdSettingPage(),// 第一次登陆密码设置
  '/forgetpwd': (context) => ForgetPwdPage(),// 忘记密码
  '/resetpwd': (context) => ResetPwdPage(),  // 重新设置密码

  '/strategy': (context) => StrategyPage(), // 策略详情
  '/createstrategy': (context) => CreateStrategy() // 创建
};

var onGenerateRoute = (RouteSettings settings) {
  // 统一处理
  final String name = settings.name;
  final Function pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = CupertinoPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
          CupertinoPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};